package com.zat.mes.andrmes.dofun.work.adapter

import android.media.Image
import android.text.TextUtils
import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.data.GetPackBean
import com.zat.mes.andrmes.data.MacCheckBean
import com.zat.mes.andrmes.data.MachineCareDayBean

/**
 * @author zy
 * @date :2020-02-22 09:28
 * @description: 机器日保养
 */
class MacCareDayAdapter(layoutResId: Int) :
    BaseQuickAdapter<MachineCareDayBean, BaseViewHolder>(layoutResId), LoadMoreModule {

    override fun convert(helper: BaseViewHolder, item: MachineCareDayBean) {
        helper.setText(R.id.tvEmpNameMacCkList, "员工："+item?.empName)
        helper.setText(R.id.tvMacNoCkList, "设备编码："+item?.machineNo)
        if (item?.overhead == "1") {
            helper.getView<ImageView>(R.id.ivOverheadCkList).setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivOverheadCkList).setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.leftAndRightFeeders == "1") {
            helper.getView<ImageView>(R.id.ivLeftAndRightFeedersCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivLeftAndRightFeedersCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.sideSpring == "1") {
            helper.getView<ImageView>(R.id.ivsideSpringDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivsideSpringDataCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.headBrush == "1") {
            helper.getView<ImageView>(R.id.ivheadBrushDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivheadBrushDataCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.railheadAndAfterbody == "1") {
            helper.getView<ImageView>(R.id.ivrailheadAndAfterbodyCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivrailheadAndAfterbodyCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }

        if (item?.aroundAndScissors == "1") {
            helper.getView<ImageView>(R.id.ivaroundAndScissorsCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivaroundAndScissorsCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.machineAndSideCover == "1") {
            helper.getView<ImageView>(R.id.ivmachineAndSideCoverDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivmachineAndSideCoverDataCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.glassCoverInOut == "1") {
            helper.getView<ImageView>(R.id.ivglassCoverInOutCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivglassCoverInOutCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.waterAndOil == "1") {
            helper.getView<ImageView>(R.id.ivwaterAndOilCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivwaterAndOilCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.settlerBed == "1") {
            helper.getView<ImageView>(R.id.ivsettlerBedCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivsettlerBedCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }

    }
}